define (require, exports, module) ->
  # 引入样式
  require 'mods/top_tips/top_tips_css.css'
  # 定义头部组件
  cError = Vue.extend
    data: () ->
      timers: []
    props: ['topTipsOption']
    template: require 'mods/top_tips/top_tips_tpl.js'
    methods:
      countDown: () ->
        self = @
        if self?.topTipsOption?.auto_close
          t = setTimeout () ->
            self.topTipsOption.state =  false
          , self?.topTipsOption?.show_time or 2000
          self.timers.push t
    watch:
      topTipsOption: () ->
        self = @
        self.topTipsOption.tip_type = self?.topTipsOption?.tip_type or 'error' 
        self.timers.forEach (timer) => 
          window.clearTimeout timer
        self.timers = []
        self.countDown()
  # 注册全局组件
  Vue.component 'c-top-tips', cError